package org.example.cloud.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.example.cloud.bean.User;

@Mapper
public interface UserMapper {
    @Insert("INSERT INTO `user`(`userName`, `password`, `email`) VALUES(#{userName}, #{password}, #{email})")
    @Options(useGeneratedKeys = true, keyProperty = "userId")
    int insertUser(User user);
    // 根据用户名查询用户
    @Select("SELECT * FROM `user` WHERE `userName` = #{userName}")
    User findByUsername(String userName);
} 